home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / os20 / wb / pat2icon.lha / pat2icon / window.c < prev    next >
C/C++ Source or Header  |  1992-10-03  |  3KB  |  107 lines

  1. /*
  2.  *  Source generated with GadToolsBox V1.4
  3.  *  which is (c) Copyright 1991,92 Jaba Development
  4.  */
  5.  
  6. #include <exec/types.h>
  7. #include <intuition/intuition.h>
  8. #include <intuition/classes.h>
  9. #include <intuition/classusr.h>
  10. #include <intuition/imageclass.h>
  11. #include <intuition/gadgetclass.h>
  12. #include <libraries/gadtools.h>
  13. #include <graphics/displayinfo.h>
  14. #include <graphics/gfxbase.h>
  15. #include <proto/exec.h>
  16. #include <proto/intuition.h>
  17. #include <proto/gadtools.h>
  18. #include <proto/graphics.h>
  19. #include <proto/utility.h>
  20. #include <string.h>
  21.  
  22. #include "window.h"
  23.  
  24. struct Screen         *Scr = NULL;
  25. APTR                   VisualInfo = NULL;
  26. struct Window         *AppWnd = NULL;
  27. UWORD                  AppLeft = 223;
  28. UWORD                  AppTop = 49;
  29. UWORD                  AppWidth = 176;
  30. UWORD                  AppHeight = 27;
  31. UBYTE                 *AppWdt = (UBYTE *)"pat2icon v1.0";
  32.  
  33. struct TextAttr topaz8 = {
  34.     ( STRPTR )"topaz.font", 8, 0x00, 0x01 };
  35.  
  36. struct IntuiText  AppIText[] = {
  37.     2, 0, JAM1,21, 7, &topaz8, (UBYTE *)"Drop icons here!", NULL };
  38.  
  39. int SetupScreen( void )
  40. {
  41.     if ( ! ( Scr = LockPubScreen( NULL )))
  42.         return( 1L );
  43.  
  44.     if ( ! ( VisualInfo = GetVisualInfo( Scr, TAG_DONE )))
  45.         return( 2L );
  46.  
  47.     return( 0L );
  48. }
  49.  
  50. void CloseDownScreen( void )
  51. {
  52.     if ( VisualInfo ) {
  53.         FreeVisualInfo( VisualInfo );
  54.         VisualInfo = NULL;
  55.     }
  56.  
  57.     if ( Scr        ) {
  58.         UnlockPubScreen( NULL, Scr );
  59.         Scr = NULL;
  60.     }
  61. }
  62.  
  63. void AppRender( void )
  64. {
  65.     UWORD        offx, offy;
  66.  
  67.     offx = AppWnd->BorderLeft;
  68.     offy = AppWnd->BorderTop;
  69.  
  70.     PrintIText( AppWnd->RPort, AppIText, offx, offy );
  71. }
  72.  
  73. int OpenAppWindow( void )
  74. {
  75.     struct NewGadget     ng;
  76.     struct Gadget       *g;
  77.     UWORD                lc, tc;
  78.     UWORD                offx = Scr->WBorLeft,offy = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
  79.  
  80.     if ( ! ( AppWnd = OpenWindowTags( NULL,
  81.                     WA_Left,          AppLeft,
  82.                     WA_Top,           AppTop,
  83.                     WA_Width,         AppWidth,
  84.                     WA_Height,        AppHeight + offy,
  85.                     WA_IDCMP,         IDCMP_CLOSEWINDOW|IDCMP_REFRESHWINDOW,
  86.                     WA_Flags,         WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH,
  87.                     WA_Title,         AppWdt,
  88.                     WA_PubScreen,     Scr,
  89.                     TAG_DONE )))
  90.         return( 4L );
  91.  
  92.     GT_RefreshWindow( AppWnd, NULL );
  93.  
  94.     AppRender();
  95.  
  96.     return( 0L );
  97. }
  98.  
  99. void CloseAppWindow( void )
  100. {
  101.     if ( AppWnd        ) {
  102.         CloseWindow( AppWnd );
  103.         AppWnd = NULL;
  104.     }
  105. }
  106.  
  107.